<template>
  <el-dialog width="900px" :close-on-click-modal="false" :visible.sync="visible" center @close="onClose">
    <template v-slot:title>
      <h2>【{{ examName }}】成绩分析</h2>
    </template>
    <data-table
      v-if="apiSetting.params.paperId"
      ref="dtb"
      :api-setting="apiSetting"
      index-column
    >
      <el-table-column
        fixed
        prop="organizeName"
        label="班级名称"
        width="120"
        show-overflow-tooltip
      />
      <el-table-column
        prop="candidatesNum"
        label="应考人数"
        width="80"
        show-overflow-tooltip
      />
      <el-table-column
        prop="examinationNumber"
        label="实考人数"
        width="80"
        show-overflow-tooltip
      />
      <el-table-column
        prop="examinationProportion"
        label="实考比例"
        width="80"
        show-overflow-tooltip
      />
      <el-table-column label="优秀" width="80" show-overflow-tooltip>
        <el-table-column
          prop="excellentNumber"
          label="人数"
          show-overflow-tooltip
        />
        <el-table-column
          prop="excellentProportion"
          label="比率"
          show-overflow-tooltip
        />
      </el-table-column>
      <el-table-column label="良好" width="80" show-overflow-tooltip>
        <el-table-column prop="goodNumber" label="人数" show-overflow-tooltip />
        <el-table-column
          prop="goodProportion"
          label="比率"
          show-overflow-tooltip
        />
      </el-table-column>
      <el-table-column label="及格" width="80" show-overflow-tooltip>
        <el-table-column prop="passNumber" label="人数" show-overflow-tooltip />
        <el-table-column
          prop="passProportion"
          label="比率"
          show-overflow-tooltip
        />
      </el-table-column>
      <el-table-column label="不及格" width="80" show-overflow-tooltip>
        <el-table-column
          prop="failedNumber"
          label="人数"
          show-overflow-tooltip
        />
        <el-table-column
          prop="failedProportion"
          label="比率"
          show-overflow-tooltip
        />
      </el-table-column>
      <el-table-column
        prop="average"
        label="平均分"
        width="80"
        show-overflow-tooltip
      />
    </data-table>
  </el-dialog>
</template>

<script>
import dialog from "@/mixins/component/dialog";

export default {
  name: "result",
  mixins: [dialog],
  data() {
    return {
      apiSetting: {
        method: "get",
        url: "/sys/examAnalysis/getAchievementAnalysis",
        params: {
          paperId: 0,
          examId: 0
        }
      },
      examName: ""
    };
  },
  methods: {
    setParams(paperId, examId, reload = true) {
      this.apiSetting.params.paperId = paperId;
      this.apiSetting.params.examId = examId;
      if (this.$refs.dtb && reload) {
        this.$refs.dtb.loadData();
        return;
      }
    }
  }
};
</script>

<style scoped></style>
